A Guide to HID Emulation & Security
Combines a small breakout board (USB-A) with an Atmel (Microchip) ATTiny85 Microcontroller.
| Spec | Value |
|---|---|
| Input Voltage | 5V (USB) |
| Flash Memory | 8 KB (6 KB available for user code) |
| SRAM | 512 bytes (~400B available with USB libraries) |
| EEPROM | 512 bytes |
| Clock Speed | 16.5 MHz (internal oscillator) |
| Digital I/O Pins | 6 (all support PWM) |
| Analog Input Pins | 3 |
A one-button device that emits a pseudo-random key press each time the button is pressed.
(Press down for source code)
/**
* any key - press the push button and a random key is sent on the USB keyboard
* requires a DigiSpark and a push button connecting PIN_BUTTON to GND
*/
#include "DigiKeyboard.h"
#define PIN_BUTTON 2
#define PIN_LED 1
#define DEBOUNCE_TIME 220
volatile bool isButtonPushed = false;
volatile static unsigned long lastPressedTime = 0;
void setup() {
pinMode(PIN_BUTTON, INPUT_PULLUP);
attachInterrupt(0, buttonPush, CHANGE);
pinMode(PIN_LED, OUTPUT);
digitalWrite(PIN_LED, LOW);
DigiKeyboard.sendKeyStroke(0);
DigiKeyboard.delay(250);
}
void loop() {
if(isButtonPushed) {
digitalWrite(PIN_LED, HIGH);
DigiKeyboard.sendKeyStroke(random(4, 56));
isButtonPushed = false;
digitalWrite(PIN_LED, LOW);
}
DigiKeyboard.delay(5);
}
void buttonPush() {
if (millis()-lastPressedTime > DEBOUNCE_TIME) {
isButtonPushed = true;
lastPressedTime = millis();
}
}
Subtly moves the mouse pointer to prevent lock screens or annoy colleagues.
(Press down for source code)
// Digispark Mouse Jiggler
// Written by James Franklin for Air-Gap in 2019
#include <DigiMouse.h>
unsigned int LowerCycleTime = 10000;
unsigned int UpperCycleTime = 30000;
void setup() {
randomSeed(analogRead(0));
pinMode(1, OUTPUT);
DigiMouse.begin();
}
void loop() {
// Moves mouse 1 pixel in a direction (up/down/left/right) in a square
digitalWrite(1, HIGH);
DigiMouse.moveY(1);
DigiMouse.delay(50);
digitalWrite(1, LOW);
DigiMouse.delay(random(LowerCycleTime, UpperCycleTime));
// (Repeats for X(1), Y(-1), and X(-1) to complete the square)
}